﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[vwWH_ServerRoleMembers_dbo_sysadmin_Summary]
#-- Purpose:		Reports on the db_owner and sysadmin role membership grants;
#--					Summarizes details from database level
#--	Last Update:	12/30/2015
#--					For a complete history - please review comments in Version
#--					Control.
#------------------------------------------------------------------------------
*/
CREATE VIEW [dbo].[vwWH_ServerRoleMembers_dbo_sysadmin_Summary]
AS
SELECT		[ssd_sqlserver_name_ro] [Server Name],
			[srm_member_name] [Member Name],
			[srm_role_name] [Role Name],
			[arm_reasoning] [Comments],
			(CASE WHEN MIN(CAST([satisfactory_reason] as tinyint)) = 1 THEN 'Yes' ELSE NULL END) [Satisfactory Reason]
FROM		[dbo].[vwWH_ServerRoleMembers_dbo_sysadmin_Detail]
GROUP BY	[ssd_sqlserver_name_ro],
			[srm_member_name],
			[srm_role_name],
			[arm_reasoning]
